/**
 * *@Copyright: 2019 www.pingshiedu.com inc . All rights reserved.
 * *注意：本内容仅限于评师教育内部传阅，禁止外泄以及用于其他的商业目
 */
package azkaban.dag;

import azkaban.execapp.HttpUtils;
import com.google.gson.JsonObject;
import org.apache.commons.httpclient.util.ExceptionUtil;
import org.codehaus.jettison.json.JSONObject;
import org.junit.Test;

/**
 * *@Author duhanmin
 * *@Date 2019/11/16 15:12
 */
public class trest {

    private static JsonObject json = new JsonObject();
    static{
        json.addProperty("msgtype","markdown");
    }

    @Test
    public void test(){

        JsonObject markdown = new JsonObject();
        markdown.addProperty("title","离线报警");

        StringBuilder msgss = new StringBuilder();

       msgss.append("# ").append("出现错误").append("\n > 请及时处理")
                .append("\n > ###  Azkaban项目 \n > ").append("00000000")
                .append("\n > ### 工作流job \n > ").append("00000000")
                .append("\n > ### 状态 \n > ").append("00000000");

        markdown.addProperty("text",msgss.toString());

        json.addProperty("markdown",markdown.toString());

        HttpUtils.doPost("https://oapi.dingtalk.com/robot/send?access_token=20081acc78717fd049333317681a904303c39a37894d20b48f89236ed7266d2d" +
                "",json.toString());
    }
}
